home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 5.2 KB | 188 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWClnInf.cpp
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWFrameW.hpp"
-
- #ifndef FWCLNINF_H
- #include "FWClnInf.h"
- #endif
-
- #ifndef FWFRAME_H
- #include "FWFrame.h"
- #endif
-
- #ifndef FWPART_H
- #include "FWPart.h"
- #endif
-
- #ifndef FWSOMENV_H
- #include "FWSOMEnv.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_ODDraft_xh
- #include <Draft.xh>
- #endif
-
- #ifndef SOM_ODShape_xh
- #include <Shape.xh>
- #endif
-
- //========================================================================================
- // Runtime Info
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment fwclninf
- #endif
-
- FW_DEFINE_AUTO(FW_CCloneInfo)
-
- //========================================================================================
- // struct FW_CCloneInfo
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_CCloneInfo::FW_CCloneInfo
- //----------------------------------------------------------------------------------------
-
- FW_CCloneInfo::FW_CCloneInfo(Environment* ev, ODDraft* fromDraft, FW_CFrame* scopeFrame, ODCloneKind cloneKind):
- fKey(0),
- fFromDraft(fromDraft),
- fScopeFrame(scopeFrame),
- fCloning(FALSE),
- fBeganClone(FALSE),
- fCloneKind(cloneKind),
- fClonedProxyList(NULL),
- fClonedPartID(kODNULLID),
- fClonedFrameID(kODNULLID),
- fFrameShape(NULL)
- {
- FW_UNUSED(ev);
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CCloneInfo::FW_CCloneInfo
- //----------------------------------------------------------------------------------------
-
- FW_CCloneInfo::FW_CCloneInfo(Environment* ev, ODDraftKey key, ODDraft* fromDraft, FW_CFrame* scopeFrame, ODCloneKind cloneKind):
- fKey(key),
- fFromDraft(fromDraft),
- fToDraft(NULL),
- fScopeFrame(scopeFrame),
- fCloning(TRUE),
- fBeganClone(FALSE),
- fCloneKind(cloneKind),
- fClonedProxyList(NULL),
- fClonedPartID(kODNULLID),
- fClonedFrameID(kODNULLID),
- fFrameShape(NULL)
- {
- FW_UNUSED(ev);
- FW_END_CONSTRUCTOR
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CCloneInfo::~FW_CCloneInfo
- //----------------------------------------------------------------------------------------
-
- FW_CCloneInfo::~FW_CCloneInfo()
- {
- FW_START_DESTRUCTOR
-
- FW_SOMEnvironment ev;
-
- if (fCloning && fBeganClone)
- fFromDraft->AbortClone(ev, fKey);
-
- if (fFrameShape)
- fFrameShape->Release(ev);
-
- if (fClonedProxyList)
- {
- delete fClonedProxyList; // will call remove all
- fClonedProxyList = NULL;
- }
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CCloneInfo::BeginClone
- //----------------------------------------------------------------------------------------
-
- void FW_CCloneInfo::BeginClone(Environment* ev, ODDraft* destinationDraft)
- {
- FW_ASSERT(!fCloning);
- fToDraft = destinationDraft;
- fKey = fFromDraft->BeginClone(ev, destinationDraft, fScopeFrame ? fScopeFrame->GetODFrame(ev) : NULL, fCloneKind);
- fCloning = TRUE;
- fBeganClone = TRUE;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CCloneInfo::EndClone
- //----------------------------------------------------------------------------------------
-
- void FW_CCloneInfo::EndClone(Environment* ev)
- {
- FW_ASSERT(fCloning);
- FW_ASSERT(fBeganClone);
-
- fFromDraft->EndClone(ev, fKey);
- fCloning = FALSE;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CCloneInfo::AbortClone
- //----------------------------------------------------------------------------------------
-
- void FW_CCloneInfo::AbortClone(Environment* ev)
- {
- FW_ASSERT(fCloning);
- FW_ASSERT(fBeganClone);
-
- fFromDraft->AbortClone(ev, fKey);
- fCloning = FALSE;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CCloneInfo::Clone
- //----------------------------------------------------------------------------------------
-
- ODID FW_CCloneInfo::Clone(Environment* ev, ODID fromObjectID, ODID toObjectID, ODID scope)
- {
- FW_ASSERT(fCloning);
-
- return fFromDraft->Clone(ev, fKey, fromObjectID, toObjectID, scope);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CCloneInfo::GetDataInterchange
- //----------------------------------------------------------------------------------------
-
- FW_CDataInterchange* FW_CCloneInfo::GetDataInterchange(Environment* ev) const
- {
- return fScopeFrame->GetPart(ev)->GetDataInterchange(ev);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CCloneInfo::GetDraftKey
- //----------------------------------------------------------------------------------------
-
- ODDraftKey FW_CCloneInfo::GetDraftKey(Environment* ev) const
- {
- FW_UNUSED(ev);
- // fKey is not valid if not between Begin and end clone
- FW_ASSERT(fCloning);
-
- return fKey;
- }
-
-